<template>
  <div class="avian-watch-platform">
    <!-- 主要内容区域 -->
    <main class="main-content">
      <!-- 视频监测大屏 -->
      <section class="monitoring-section">
        <div class="section-header">
          <h2>实时监测</h2>
        </div>

        <div class="video-wall">
          <!-- 主视频区域 -->
          <div class="main-video">
            <video
                ref="mainVideo"
                :src="currentVideo.src"
                autoplay
                muted
                @ended="handleVideoEnded"
            ></video>

            <!-- 视频叠加信息 -->
            <div class="video-overlay">
              <div class="video-info">
                <h3>{{ currentVideo.title }}</h3>
                <p>{{ currentLocationName }} • {{ currentTime }}</p>
              </div>
              <div class="video-controls">
                <button @click="togglePlay">
                  <i :class="isPlaying ? 'fas_fa-pause' : 'fas_fa-play'"></i>
                </button>
                <div class="video-nav">
                  <button @click="prevVideo"><i class="fas_fa-chevron-left"></i></button>
                  <span>{{ currentVideoIndex + 1 }}/{{ videoList.length }}</span>
                  <button @click="nextVideo"><i class="fas_fa-chevron-right"></i></button>
                </div>
                <div class="timestamp">{{ currentTime }}</div>
              </div>
            </div>
          </div>

          <!-- 视频缩略图列表 -->
          <div class="video-thumbnails">
            <div
                class="thumbnail"
                v-for="(video, idx) in videoList"
                :key="idx"
                :class="{ active: currentVideoIndex === idx }"
                @click="switchVideo(idx)"
            >
              <video :src="video.src" muted></video>
              <div class="thumb-info">
                <span>{{ video.title }}</span>
                <i class="fas fa-check" v-if="currentVideoIndex === idx"></i>
              </div>
            </div>
          </div>
        </div>

        <!-- 监测数据统计 -->
        <div class="stats-panel">
          <div class="stat-card">
            <div class="stat-icon" style="background-color: #e3f9e5;">
              <i class="fas_fa-dove" style="color: #27ae60;">
                <img src="@/assets/cameraicon/count.png">
              </i>
            </div>
            <div class="stat-info">
              <h3>实时数量</h3>
              <p>{{ currentDetections.length }}</p>
            </div>
          </div>
          <div class="stat-card">
            <div class="stat-icon" style="background-color: #e3f2fd;">
              <i class="fas_fa-clock" style="color: #3498db;">
                <img src="@/assets/cameraicon/nowcount.png">
              </i>
            </div>
            <div class="stat-info">
              <h3>今日累计</h3>
              <p>328</p>
            </div>
          </div>
          <div class="stat-card">
            <div class="stat-icon" style="background-color: #fff8e1;">
              <i class="fas_fa-bullseye" style="color: #f39c12;">
                <img src="@/assets/cameraicon/zhunque.png">
              </i>
            </div>
            <div class="stat-info">
              <h3>识别准确率</h3>
              <p>96.7%</p>
            </div>
          </div>
          <div class="stat-card">
            <div class="stat-icon" style="background-color: #ffebee;">
              <i class="fas_fa-exclamation-triangle" style="color: #e74c3c;">
                <img src="@/assets/cameraicon/alart.png">
              </i>
            </div>
            <div class="stat-info">
              <h3>预警事件</h3>
              <p>5</p>
            </div>
          </div>
        </div>
      </section>

      <!-- 预警信息 -->
      <section class="alerts-section">
        <div class="section-header">
          <h2>预警信息</h2>
          <div class="view-all" @click="moreInfo">查看更多>></div>
        </div>

        <div class="alerts-grid">
          <div
              class="alert-card"
              v-for="(alert, idx) in recentAlertsTop3"
              :key="idx"
              :class="`level-${alert.level}`"
          >
            <div class="alert-header">
              <h3>{{ alert.title }}</h3>
              <span class="alert-time">{{ alert.time }}</span>
            </div>
            <div class="alert-body">
              <p><i class="fas_fa-map-marker-alt"></i> {{ alert.location }}</p>
              <p>{{ alert.description }}</p>
            </div>
            <div class="alert-footer">
              <el-button class="details-btn" @click="showDetails(alert)">查看详情</el-button>
            </div>
          </div>
        </div>
      </section>

      <!-- 数据分析 -->
      <section class="analytics-section">
        <div class="section-header">
          <h2><i class="fas fa-chart-line"></i> 活动分析</h2>
        </div>

        <div class="analytics-content">
          <div class="chart-container">
            <div class="chart" ref="activityChart" style="width: 100%; height: 300px;"></div>
          </div>

          <div class="hotspots-panel">
            <h3><i class="fas fa-map-marked-alt"></i> 热点区域</h3>
            <div class="hotspot-list">
              <div class="hotspot-item" v-for="(spot, idx) in hotspots" :key="idx">
                <div class="spot-rank">{{ idx + 1 }}</div>
                <div class="spot-info">
                  <h4>{{ spot.area }}</h4>
                  <p>{{ spot.location }}</p>
                </div>
                <div class="spot-stats">
                  <div class="progress-bar">
                    <div
                        class="progress"
                        :style="{ width: `${spot.percentage}%`, backgroundColor: spot.color }"
                    ></div>
                  </div>
                  <span>{{ spot.count }}次检测</span>
                </div>
              </div>
            </div>
          </div>
        </div>
      </section>
    </main>
  </div>

  <!-- 详情弹窗 -->
  <el-dialog
      title="详情信息"
      v-model="details"
      width="50%"
      top="2vh"
  >
    <div class="details-container">
      <div class="header-background">
        <div class="bird-icon">
        </div>
      </div>

      <div class="details-content">
        <div class="details-title">{{ detailsInfo.title }}</div>
        <div class="details-address">
          {{ detailsInfo.location }}
        </div>
        <div class="details-grid">
          <div class="details-bird">
            <div class="section-header">
              鸟类信息
            </div>
            <div class="bird-type">{{ detailsInfo.birdType }}</div>
          </div>

          <div class="details-description">
            <div class="section-header">
              观测描述
            </div>
            <div class="section-content">{{ detailsInfo.description }}</div>
          </div>

          <div class="details-image">
            <div class="section-header">
              观测照片
            </div>
            <div class="image-container" @click="openImagePreview(detailsInfo.image)">
              <img :src="detailsInfo.image" alt="鸟类观测照片">
              <div class="image-overlay">
              </div>
            </div>
          </div>

          <div class="details-suggestion">
            <div class="section-header">
              保护建议
            </div>
            <div class="section-content">{{ detailsInfo.suggestion }}</div>
          </div>
        </div>
      </div>
    </div>
  </el-dialog>

  <!-- 图片预览弹窗 -->
  <el-dialog
      v-model="imagePreviewVisible"
      width="45%"
      @close="closeImagePreview"
  >
    <div class="image-preview-container">
      <img :src="previewImage" alt="鸟类图片预览" class="preview-image">
    </div>
  </el-dialog>



</template>

<script setup>
import { ref, reactive, computed, onMounted, onBeforeUnmount } from 'vue'
import { useRouter, useRoute } from "vue-router";
import * as echarts from 'echarts';
import test1 from '@/assets/video/test1.mp4';
import test2 from '@/assets/video/test2.mp4';
import test3 from '@/assets/video/test3.mp4';
import bird1 from '@/assets/bird/10.jpeg';
import bird2 from '@/assets/bird/11.jpeg';
import bird3 from '@/assets/bird/30.jpeg';
// 响应式数据
const currentLocation = ref('east')
const locations = reactive([
  { id: 'east', name: '东部机场监测点' },
  { id: 'south', name: '南部农田监测点' },
  { id: 'west', name: '西部保护区监测点' },
  { id: 'north', name: '北部林区监测点' }
])

const videoList = reactive([
  {
    src: test1,
    title: '机场跑道北侧',
    detections: [
      { x: 25, y: 35, width: 8, height: 10, confidence: 97 },
      { x: 60, y: 50, width: 7, height: 9, confidence: 93 }
    ]
  },
  {
    src: test2,
    title: '农田3号区域',
    detections: [
      { x: 40, y: 30, width: 9, height: 11, confidence: 95 },
      { x: 70, y: 65, width: 6, height: 8, confidence: 88 }
    ]
  },
  {
    src: test3,
    title: '森林观测站',
    detections: [
      { x: 35, y: 25, width: 10, height: 12, confidence: 96 }
    ]
  }
])

const details = ref(false)


const currentVideoIndex = ref(0)
const currentTime = ref('')
const timer = ref(null)
const isPlaying = ref(true)
const mainVideo = ref(null)
const activityChart = ref(null)
const detailsInfo = ref(null)

// 图片预览相关状态
const imagePreviewVisible = ref(false)
const previewImage = ref('')


// 打开图片预览
const openImagePreview = (img) => {
  previewImage.value = img
  imagePreviewVisible.value = true
}

// 关闭图片预览
const closeImagePreview = () => {
  imagePreviewVisible.value = false
}

// 查看详细信息
const showDetails = (item) => {
  details.value = true
  detailsInfo.value = item
}


const router = useRouter()
// 跳转到检测列表
const moreInfo = () => {
  router.push('/warning')
}

const recentAlerts = reactive([
  {
    level: 3,
    title: '机场区域鸟类活动频繁',
    location: '东部机场监测点',
    time: '10:23:45',
    description: '跑道北侧检测到5只鸟类活动，建议立即驱鸟',
    image: bird1,
    birdType: '池鹭',
    suggestion: '建议启动驱鸟器驱赶'
  },
  {
    level: 2,
    title: '农田区域检测到鸟类聚集',
    location: '南部农田监测点',
    time: '09:45:12',
    description: '3号区域检测到鸟群，可能对作物造成损害',
    image: bird2,
    birdType: '珠颈斑鸠',
    suggestion: '建议铺设覆盖鸟网，避免鸟害'
  },
  {
    level: 1,
    title: '保护区发现异常活动',
    location: '西部保护区监测点',
    time: '08:30:56',
    description: '观测站附近检测到稀有鸟类活动',
    image: bird3,
    birdType: '乌鸫',
    suggestion: '建议果实套袋，避免鸟类吃食'
  },
  {
    level: 2,
    title: '农田区域检测到鸟类聚集',
    location: '南部农田监测点',
    time: '09:45:12',
    description: '3号区域检测到鸟群，可能对作物造成损害',
    image: bird2,
    birdType: '珠颈斑鸠',
    suggestion: '建议铺设覆盖鸟网，避免鸟害'
  },
  {
    level: 2,
    title: '农田区域检测到鸟类聚集',
    location: '南部农田监测点',
    time: '09:45:12',
    description: '3号区域检测到鸟群，可能对作物造成损害',
    image: bird2,
    birdType: '珠颈斑鸠',
    suggestion: '建议铺设覆盖鸟网，避免鸟害'
  },
  {
    level: 2,
    title: '农田区域检测到鸟类聚集',
    location: '南部农田监测点',
    time: '09:45:12',
    description: '3号区域检测到鸟群，可能对作物造成损害',
    image: bird2,
    birdType: '珠颈斑鸠',
    suggestion: '建议铺设覆盖鸟网，避免鸟害'
  },
  {
    level: 2,
    title: '农田区域检测到鸟类聚集',
    location: '南部农田监测点',
    time: '09:45:12',
    description: '3号区域检测到鸟群，可能对作物造成损害',
    image: bird2,
    birdType: '珠颈斑鸠',
    suggestion: '建议铺设覆盖鸟网，避免鸟害'
  },
])

const recentAlertsTop3 = computed(() => {
  return recentAlerts.slice(0, 3)
})

const hotspots = reactive([
  {
    area: '机场跑道东侧',
    location: '东部机场监测点',
    count: 156,
    percentage: 85,
    color: '#3498db'
  },
  {
    area: '农田3号区域',
    location: '南部农田监测点',
    count: 112,
    percentage: 64,
    color: '#27ae60'
  },
  {
    area: '森林观测点B',
    location: '西部保护区监测点',
    count: 78,
    percentage: 48,
    color: '#f39c12'
  },
  {
    area: '水库周边',
    location: '北部林区监测点',
    count: 45,
    percentage: 30,
    color: '#e74c3c'
  }
])

// 计算属性
const currentVideo = computed(() => {
  return videoList[currentVideoIndex.value]
})

const currentDetections = computed(() => {
  return currentVideo.value.detections
})

const currentLocationName = computed(() => {
  const loc = locations.find(l => l.id === currentLocation.value)
  return loc ? loc.name : ''
})

const formattedTime = computed(() => {
  return formatTime(new Date())
})

// 方法
const togglePlay = () => {
  if (mainVideo.value.paused) {
    mainVideo.value.play()
    isPlaying.value = true
  } else {
    mainVideo.value.pause()
    isPlaying.value = false
  }
}

const prevVideo = () => {
  if (currentVideoIndex.value > 0) {
    currentVideoIndex.value--
  } else {
    currentVideoIndex.value = videoList.length - 1
  }
  playCurrentVideo()
}

const nextVideo = () => {
  if (currentVideoIndex.value < videoList.length - 1) {
    currentVideoIndex.value++
  } else {
    currentVideoIndex.value = 0
  }
  playCurrentVideo()
}

const playCurrentVideo = () => {
  mainVideo.value.play()
  isPlaying.value = true
}

//自动跳转
// const handleVideoEnded = () => {
//   nextVideo()
// }

const switchVideo = (index) => {
  currentVideoIndex.value = index
  playCurrentVideo()
}

const formatTime = (date) => {
  const hours = date.getHours().toString().padStart(2, '0')
  const minutes = date.getMinutes().toString().padStart(2, '0')
  return `${hours}:${minutes}`
}

const updateCurrentTime = () => {
  currentTime.value = formatTime(new Date())
}

const initChart = () => {
  const chart = echarts.init(activityChart.value)

  const option = {
    tooltip: {
      trigger: 'axis',
      axisPointer: {
        type: 'shadow'
      }
    },
    legend: {
      data: ['东部机场', '南部农田', '西部保护区', '北部林区']
    },
    grid: {
      left: '3%',
      right: '4%',
      bottom: '3%',
      containLabel: true
    },
    xAxis: {
      type: 'category',
      data: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月']
    },
    yAxis: {
      type: 'value',
      name: '检测次数'
    },
    series: [
      {
        name: '东部机场',
        type: 'bar',
        stack: 'total',
        emphasis: {
          focus: 'series'
        },
        data: [120, 132, 101, 134, 90, 230, 210, 180, 150, 120, 110, 100],
        itemStyle: {
          color: '#3498db'
        }
      },
      {
        name: '南部农田',
        type: 'bar',
        stack: 'total',
        emphasis: {
          focus: 'series'
        },
        data: [80, 92, 91, 94, 100, 130, 110, 120, 90, 80, 70, 60],
        itemStyle: {
          color: '#27ae60'
        }
      },
      {
        name: '西部保护区',
        type: 'bar',
        stack: 'total',
        emphasis: {
          focus: 'series'
        },
        data: [60, 72, 71, 74, 80, 90, 70, 60, 50, 40, 30, 20],
        itemStyle: {
          color: '#f39c12'
        }
      },
      {
        name: '北部林区',
        type: 'bar',
        stack: 'total',
        emphasis: {
          focus: 'series'
        },
        data: [40, 52, 51, 54, 60, 70, 50, 40, 30, 20, 10, 5],
        itemStyle: {
          color: '#e74c3c'
        }
      }
    ]
  }

  chart.setOption(option)
}

const handleResize = () => {
  if (activityChart.value) {
    echarts.getInstanceByDom(activityChart.value)?.resize()
  }
}

// 生命周期钩子
onMounted(() => {
  // 初始化视频播放
  playCurrentVideo()

  // 更新时间
  updateCurrentTime()
  timer.value = setInterval(updateCurrentTime, 60000)

  // 初始化图表
  initChart()
  window.addEventListener('resize', handleResize)
})

onBeforeUnmount(() => {
  clearInterval(timer.value)
  window.removeEventListener('resize', handleResize)
  if (activityChart.value) {
    echarts.dispose(activityChart.value)
  }
})
</script>

<style scoped>

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}


.avian-watch-platform {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
  background: linear-gradient(135deg, #e0f7fa, #c8e6c9, #a5d6a7);
}


/* 主要内容区域 */
.main-content {
  flex: 1;
  padding: 1rem 2rem 2rem;
  width: 80%;
  margin: 0 auto;
}


.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.section-header h2 {
  font-size: 1.5rem;
  color: #2c3e50;
  display: flex;
  align-items: center;
}

.view-all {
  color: #27ae60;
  text-decoration: none;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  transition: all 0.3s;
}

.view-all:hover {
  color: #3498db;
  cursor: pointer;
}

/* 监测区域样式 */
.monitoring-section {
  background-color: white;
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  margin-bottom: 2rem;
}

.video-wall {
  display: flex;
  gap: 2rem;
  margin-bottom: 1.5rem;
}

.main-video {
  flex: 3;
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background-color: black;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.main-video video {
  width: 100%;
  height: 400px;
  object-fit: cover;
  display: block;
}

.video-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.video-info {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 1rem;
  background: linear-gradient(to bottom, rgba(0,0,0,0.7), transparent);
  color: white;
}

.video-info h3 {
  font-size: 1.2rem;
  margin-bottom: 0.3rem;
}

.video-info p {
  font-size: 0.9rem;
  opacity: 0.8;
}

.video-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0,0,0,0.7);
  padding: 0.8rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  pointer-events: auto;
}

.video-controls button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: rgba(255,255,255,0.2);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
}
.fas_fa-chevron-left{
  background-image: url('@/assets/cameraicon/left.png');
  background-size: 100% 100%;
  width: 100%;
  height: 100%;
}

.fas_fa-chevron-right{
  background-image: url('@/assets/cameraicon/right.png');
  background-size: 100% 100%;
  width: 100%;
  height: 100%;
}

.fas_fa-pause{
  background-image: url('@/assets/cameraicon/stop.png');
  background-size: 100% 100%;
  width: 100%;
  height: 100%;
}
.fas_fa-play{
  background-image: url('@/assets/cameraicon/start.png');
  background-size: 100% 100%;
  width: 100%;
  height: 100%;
}

.video-controls button:hover {
  background-color: rgba(255,255,255,0.3);
  transform: scale(1.1);
}

.video-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 auto;
}

.video-nav span {
  color: white;
  font-size: 0.9rem;
  min-width: 50px;
  text-align: center;
}

.timestamp {
  color: white;
  font-size: 0.9rem;
  margin-left: auto;
}

.video-thumbnails {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.thumbnail {
  position: relative;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s;
  border: 2px solid transparent;
}

.thumbnail:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.thumbnail.active {
  border-color: #27ae60;
  border-width: 8px;
}

.thumbnail video {
  width: 100%;
  height: 90px;
  object-fit: cover;
  display: block;
}

.thumb-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.5rem;
  background: rgba(0,0,0,0.7);
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
}

.thumb-info i {
  color: #27ae60;
}

.stats-panel {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.stat-card {
  background-color: white;
  border-radius: 6px;
  padding: 1rem;
  display: flex;
  align-items: center;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
  transition: transform 0.3s;
  border-left: 4px solid #27ae60;
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.fas_fa-dove{
  display: flex;
  justify-content: center;
  align-items: center;
}

.fas_fa-dove img{
  width: 80%;
  height: 80%;
}

.fas_fa-clock{
  display: flex;
  justify-content: center;
  align-items: center;
}

.fas_fa-clock img{
  width: 100%;
  height: 100%;
}

.fas_fa-bullseye{
  display: flex;
  justify-content: center;
  align-items: center;
}

.fas_fa-bullseye img{
  width: 100%;
  height: 100%;
}

.fas_fa-exclamation-triangle{
  display: flex;
  justify-content: center;
  align-items: center;
}

.fas_fa-exclamation-triangle img{
  width: 100%;
  height: 100%;
}


.stat-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 1rem;
  font-size: 1.2rem;
}

.stat-info h3 {
  font-size: 0.9rem;
  color: #95a5a6;
  margin-bottom: 0.3rem;
}

.stat-info p {
  font-size: 1.3rem;
  font-weight: bold;
  color: #2c3e50;
}

/* 预警信息区域 */
.alerts-section {
  background-color: white;
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  margin-bottom: 2rem;
}

.alerts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.alert-card {
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  transition: transform 0.3s;
  background-color: white;
}

.alert-card:hover {
  transform: translateY(-5px);
}

.alert-card.level-3 {
  border-left: 4px solid #e74c3c;
}

.alert-card.level-2 {
  border-left: 4px solid #f39c12;
}

.alert-card.level-1 {
  border-left: 4px solid #3498db;
}

.alert-header {
  padding: 1rem;
  background-color: #f8f9fa;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.alert-header h3 {
  font-size: 1rem;
  color: #2c3e50;
}

.alert-time {
  font-size: 0.8rem;
  color: #95a5a6;
}

.alert-body {
  padding: 1rem;
}

.alert-body p {
  font-size: 0.9rem;
  color: #2c3e50;
  margin-bottom: 0.5rem;
}

.alert-body i {
  color: #95a5a6;
  margin-right: 0.5rem;
}

.alert-footer {
  padding: 0.8rem;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  border-top: 1px solid #eee;
}

.action-btn {
  padding: 0.4rem 0.8rem;
  border: none;
  border-radius: 4px;
  background-color: #27ae60;
  color: white;
  font-size: 0.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  transition: all 0.3s;
}

.action-btn:hover {
  background-color: #219653;
}

.details-btn {
  padding: 0.4rem 0.8rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  background-color: white;
  color: #2c3e50;
  font-size: 0.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  transition: all 0.3s;
}

.details-btn:hover {
  background-color: #f8f9fa;
}

/* 数据分析区域 */
.analytics-section {
  background-color: white;
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.analytics-content {
  display: flex;
  gap: 1.5rem;
}

.chart-container {
  flex: 2;
  background-color: white;
  border-radius: 6px;
  padding: 1rem;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.hotspots-panel {
  flex: 1;
  background-color: #f8f9fa;
  border-radius: 6px;
  padding: 1rem;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.hotspots-panel h3 {
  font-size: 1.1rem;
  color: #2c3e50;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.hotspots-panel h3 i {
  color: #27ae60;
}

.hotspot-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.hotspot-item {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.5rem;
  background-color: white;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.spot-rank {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: #27ae60;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: bold;
}

.spot-info {
  flex: 1;
}

.spot-info h4 {
  font-size: 0.9rem;
  color: #2c3e50;
  margin-bottom: 0.2rem;
}

.spot-info p {
  font-size: 0.8rem;
  color: #95a5a6;
}

.spot-stats {
  width: 120px;
}

.progress-bar {
  height: 6px;
  background-color: #e0e0e0;
  border-radius: 3px;
  margin-bottom: 0.3rem;
}

.progress {
  height: 100%;
  border-radius: 3px;
}

.spot-stats span {
  font-size: 0.7rem;
  color: #95a5a6;
  display: block;
  text-align: right;
}

.details-container {
  position: relative;
  border-radius: 15px;
  overflow: hidden;
  background: linear-gradient(to bottom, #f8f9fa, #e9ecef);
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.header-background {
  height: 100px;
  background: linear-gradient(to right, #27ae60, #2ecc71);
  position: relative;
  overflow: hidden;
}

.header-background::before {
  content: "";
  position: absolute;
  top: -50px;
  right: -50px;
  width: 200px;
  height: 200px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
}

.bird-icon {
  position: absolute;
  bottom: -30px;
  left: 50%;
  transform: translateX(-50%);
  width: 70px;
  height: 70px;
  background: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
  z-index: 10;
}


.details-content {
  padding: 50px 30px 30px;
  position: relative;
}

.details-title {
  font-size: 24px;
  font-weight: 700;
  color: #2c3e50;
  text-align: center;
  margin-bottom: 10px;
}

.details-address {
  text-align: center;
  color: #7f8c8d;
  font-size: 16px;
  margin-bottom: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.details-address i {
  color: #e74c3c;
}

.details-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.details-description,
.details-bird,
.details-suggestion,
.details-image {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
  transition: transform 0.3s ease;
  position: relative;
  overflow: hidden;
}

.details-description:hover,
.details-bird:hover,
.details-suggestion:hover,
.details-image:hover {
  transform: translateY(-5px);
}

.details-description::before,
.details-bird::before,
.details-suggestion::before,
.details-image::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 5px;
  height: 100%;
  background: #27ae60;
}

.section-header {
  font-size: 18px;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
}


.section-content {
  font-size: 15px;
  color: #34495e;
  line-height: 1.6;
}

.bird-type {
  display: inline-block;
  background: rgba(39, 174, 96, 0.2);
  color: #27ae60;
  padding: 5px 15px;
  border-radius: 20px;
  font-weight: 600;
  margin-bottom: 10px;
}

.image-container {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  height: 200px;
}

.image-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.image-container:hover img {
  transform: scale(1.05);
}

.image-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.image-container:hover .image-overlay {
  opacity: 1;
}

/* 图片预览样式 */
.image-preview-container {
  position: relative;
  height: 70vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.preview-image {
  margin-top: 20px;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}



/* 响应式设计 */
@media (max-width: 1200px) {
  .video-wall {
    flex-direction: column;
  }

  .stats-panel {
    grid-template-columns: repeat(2, 1fr);
  }

  .alerts-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .analytics-content {
    flex-direction: column;
  }
}

@media (max-width: 768px) {
  .header {
    flex-direction: column;
    height: auto;
    padding: 1rem;
  }

  .nav ul {
    margin: 1rem 0;
    flex-wrap: wrap;
    justify-content: center;
  }

  .stats-panel {
    grid-template-columns: 1fr;
  }

  .alerts-grid {
    grid-template-columns: 1fr;
  }

  .main-video video {
    height: 300px;
  }
}
</style>